/*
 * Hibiscus is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published
 * by the Free Software Foundation; either version 3 of the License,
 * or (at your option) any later version.
 *
 * Hibiscus is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Hibiscus; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 * USA
 *
 * Copyright (C) 2003 Tetete - http://tetete.hu.
 */
package hu.tetete.hibiscus.model;

/**
 * TODO javadoc.
 */
public enum TaxonLevel {

    /**
     * Regio.
     */
    REGIO(0, "Regio"),
    /**
     * Regnum.
     */
    REGNUM(100, "Regnum"),
    /**
     * Phylum.
     */
    PHYLUM(200, "Phylum"),
    /**
     * Classis.
     */
    CLASSIS(300, "Classis"),
    /**
     * Ordo.
     */
    ORDO(400, "Ordo"),
    /**
     * Familia.
     */
    FAMILIA(500, "Familia"),
    /**
     * Genus.
     */
    GENUS(600, "Genus"),
    /**
     * Species.
     */
    SPECIES(700, "Species");

    private final int    levelId;
    private final String name;

    private TaxonLevel(final int levelId, final String name) {
        this.levelId = levelId;
        this.name    = name;
    }

    /**
     * @return the levelId
     */
    public int getLevelId() {
        return this.levelId;
    }

    /**
     * @return the name
     */
    public String getName() {
        return this.name;
    }

    /**
     * @param taxonLevelId The db id of the taxon level
     * @return The taxon level.
     */
    public static TaxonLevel getTaxonLevel(final int taxonLevelId) {
        for (final TaxonLevel level : TaxonLevel.values()) {
            if (level.levelId == taxonLevelId) {
                return level;
            }
        }
        throw new IllegalArgumentException("The taxon level does not exist. " + taxonLevelId);
    }





}
